@import '@influxdata/clockface/dist/variables.scss';

$panel-resizer--header: 47px;
$panel-resizer--drag-handle: 30px;

.panel-resizer {
  margin-top: $cf-marg-a;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  border: $cf-border solid $g2-kevlar;
  background-color: $g2-kevlar;
  border-radius: $cf-radius 0 0 $cf-radius;
}
.panel-resizer--error-state {
  .panel-resizer--header {
    color: $c-dreamsicle
  }
}

.panel-resizer--header {
  color: $g15-platinum;
  width: $panel-resizer--header;
  flex: 0 0 $panel-resizer--header;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: $cf-marg-b 0;
}

.panel-resizer--header__multiple-controls {
  justify-content: space-between;
}

.panel-resizer--vis-toggle {
  align-items: center;
  justify-content: center;
  display: flex;
  font-size: 1.5em;
  transition: color 0.25s ease;
  width: $panel-resizer--drag-handle;
  height: $panel-resizer--drag-handle;
  position: relative;

  &:before {
    display: inline-block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

.panel-resizer--header__visible .panel-resizer--vis-toggle,
.panel-resizer--header__hidden .panel-resizer--vis-toggle {
  &:hover {
    cursor: pointer;
  }
}

.panel-resizer--header__visible .panel-resizer--vis-toggle {
  color: $c-pool;

  &:hover {
    color: $c-laser;
  }
}

.panel-resizer--header__hidden .panel-resizer--vis-toggle {
  color: $g8-storm;

  &:hover {
    color: $g13-mist;
  }
}

.panel-resizer--body,
.panel-resizer--empty,
.panel-resizer--error {
  position: relative;
  flex: 1 0 0;
}

.panel-resizer--body {
  display: flex;
  align-items: center;
}

.panel-resizer--body__visible {
  display: block;
}

.panel-resizer--error,
.panel-resizer--empty {
  color: $g15-platinum;
  user-select: none;
  padding: $cf-marg-b 0;
  font-weight: $cf-font-weight--medium;
  height: 30px;
}

.panel-resizer--error {
  color: $c-dreamsicle;
}

.panel-resizer--drag-handle {
  width: $panel-resizer--drag-handle;
  height: $panel-resizer--drag-handle;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;

  &:hover {
    cursor: ns-resize;
  }

  .panel-resizer--header__hidden & {
    display: none;
  }
}

// Hacky way to ensure the cursor is consistent during drag no matter
// where the cursor is
body.panel-resizer-dragging,
body.panel-resizer-dragging:hover {
  cursor: ns-resize !important;
  user-select: none !important;
}

.panel-resizer--drag-icon {
  width: $panel-resizer--drag-handle / 2;
  height: $cf-border;
  background-color: $g11-sidewalk;
  transition: background-color 0.25s ease;
  margin: $cf-border 0;
}

.panel-resizer--drag-handle:hover .panel-resizer--drag-icon {
  background-color: $g18-cloud;
}

.panel-resizer--drag-handle__dragging .panel-resizer--drag-icon {
  background-color: $c-pool;
}
